package com.clickpaas.timelineofUN.dao.Impl;


import com.bizcloud.ipaas.t7aef1c33e4a445f2833f9d631cb90c38.d20210202091529.codegen.SystemuserApi;
import com.bizcloud.ipaas.t7aef1c33e4a445f2833f9d631cb90c38.d20210202091529.model.*;
import com.clickpaas.timelineofUN.bean.TimelineDTOBean;
import com.clickpaas.timelineofUN.dao.SystemUserDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository
@Slf4j
public class SystemUserDaoImpl implements SystemUserDao {

    @Resource
    private TimelineDTOBean timelineDtoBean;
    @Resource
    private SystemuserApi systemuserApi;
    /**
     * 根据UserId查询登录用户数据
     *
     * @param userId
     * @return
     */
    @Override
    public SystemUserDTOResponse systemUserByUserId(String userId) {
        SystemUserDTO systemUserDTO = timelineDtoBean.systemUserDTO();
        systemUserDTO.setUser(userId);
        DataResponseListSystemUserDTO systemUserInfo = systemuserApi.findSystemUserUsingPOST(systemUserDTO);
        if (null == systemUserInfo
                || null == systemUserInfo.getData()
                || systemUserInfo.getData().size()<=0)
            return null;
        List<SystemUserDTOResponse> data = systemUserInfo.getData();
        return data.get(0);
    }
}
